## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
##
## Implementaion of miscellaneous game functions

import CvUtil
from CvPythonExtensions import *
import CvEventInterface
import CustomFunctions

# globals
cf = CustomFunctions.CustomFunctions()
gc = CyGlobalContext()

class CvGameUtils:
	"Miscellaneous game functions"
	def __init__(self): 
		pass
	
	def isVictoryTest(self):
		if ( gc.getGame().getElapsedGameTurns() > 10 ):
			return True
		else:
			return False

	def isVictory(self, argsList):
		eVictory = argsList[0]
		return True

	def isPlayerResearch(self, argsList):
		ePlayer = argsList[0]
		return True

	def getExtraCost(self, argsList):
		ePlayer = argsList[0]
		return 0

	def createBarbarianCities(self):
		return False
		
	def createBarbarianUnits(self):
		return False
		
	def skipResearchPopup(self,argsList):
		ePlayer = argsList[0]
		return False
		
	def showTechChooserButton(self,argsList):
		ePlayer = argsList[0]
		return True

	def getFirstRecommendedTech(self,argsList):
		ePlayer = argsList[0]
		return TechTypes.NO_TECH

	def getSecondRecommendedTech(self,argsList):
		ePlayer = argsList[0]
		eFirstTech = argsList[1]
		return TechTypes.NO_TECH
	
	def canRazeCity(self,argsList):
		iRazingPlayer, pCity = argsList
		return True
	
	def canDeclareWar(self,argsList):
		iAttackingTeam, iDefendingTeam = argsList
		return True
	
	def skipProductionPopup(self,argsList):
		pCity = argsList[0]
		return False
		
	def showExamineCityButton(self,argsList):
		pCity = argsList[0]
		return True

	def getRecommendedUnit(self,argsList):
		pCity = argsList[0]
		return UnitTypes.NO_UNIT

	def getRecommendedBuilding(self,argsList):
		pCity = argsList[0]
		return BuildingTypes.NO_BUILDING

	def updateColoredPlots(self):
		return False

	def isActionRecommended(self,argsList):
		pUnit = argsList[0]
		iAction = argsList[1]
		return False

	def unitCannotMoveInto(self,argsList):
		ePlayer = argsList[0]		
		iUnitId = argsList[1]
		iPlotX = argsList[2]
		iPlotY = argsList[3]
		return False

	def cannotHandleAction(self,argsList):
		pPlot = argsList[0]
		iAction = argsList[1]
		bTestVisible = argsList[2]
		return False

	def canBuild(self,argsList):
		iX, iY, iBuild, iPlayer = argsList
		pPlot = CyMap().plot(iX, iY)
		
		return -1	# Returning -1 means ignore; 0 means Build cannot be performed; 1 or greater means it can

	def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		pPlot = CyMap().plot(iPlotX,iPlotY)
#Ploeperpengel add disallow subterranean civs founding cities on flatlands
		pPlayer = gc.getPlayer(iPlayer)
		if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_SUBTERRANEAN')) and not pPlot.isHills():
			return True
#Ploeperpengel end add
		return False

	def cannotSelectionListMove(self,argsList):
		pPlot = argsList[0]
		bAlt = argsList[1]
		bShift = argsList[2]
		bCtrl = argsList[3]
		return False

	def cannotSelectionListGameNetMessage(self,argsList):
		eMessage = argsList[0]
		iData2 = argsList[1]
		iData3 = argsList[2]
		iData4 = argsList[3]
		iFlags = argsList[4]
		bAlt = argsList[5]
		bShift = argsList[6]
		return False

	def cannotDoControl(self,argsList):
		eControl = argsList[0]
		return False

	def canResearch(self,argsList):
		ePlayer = argsList[0]
		eTech = argsList[1]
		bTrade = argsList[2]
		return False

	def cannotResearch(self,argsList):
		ePlayer = argsList[0]
		eTech = argsList[1]
		bTrade = argsList[2]
		pPlayer = gc.getPlayer(ePlayer)

		if eTech == gc.getInfoTypeForString('TECH_SWAMPDWELLING'):
			return True
		
		return False

	def canDoCivic(self,argsList):
		ePlayer = argsList[0]
		eCivic = argsList[1]
		return False

	def cannotDoCivic(self,argsList):
		ePlayer = argsList[0]
		eCivic = argsList[1]
		
		return False
		
	def canTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		bIgnoreUpgrades = argsList[5]
		return False

	def cannotTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		bIgnoreUpgrades = argsList[5]
		ePlayer = pCity.getOwner()
		pPlayer = gc.getPlayer(ePlayer)
		eUnitClass = gc.getUnitInfo(eUnit).getUnitClassType()

		if pPlayer.isHuman() == False:
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_WARRIOR'):
				pPlot = pCity.plot()
				if pPlot.getNumUnits() >= 2:
					if pPlayer.canConstruct(gc.getInfoTypeForString('BUILDING_TRAINING_YARD'), False, False, False):
						return True
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_SCOUT'):
				if pPlayer.canConstruct(gc.getInfoTypeForString('BUILDING_HUNTING_LODGE'), False, False, False):
					return True
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_SETTLER'):
				if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_DWARVES'):  
					if pPlayer.getGold() / pPlayer.getNumCities() <= 149:
						return True
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_HEDGEWIZARD'):
				if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_HEDGEWIZARD')) > 3:
					return True

#		if eUnit == gc.getInfoTypeForString('UNIT_BLOODTHIRSTER'):
#			if pCity.getPopulation() <= 5:
#				return True

		if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_MILITARY')) == gc.getInfoTypeForString('CIVIC_CRUSADERS'):
			if eUnit == gc.getInfoTypeForString('UNITCLASS_WORKER'):
				return True
			if eUnit == gc.getInfoTypeForString('UNITCLASS_SETTLER'):
				return True
			if eUnit == gc.getInfoTypeForString('UNIT_WORKBOAT'):
				return True

		return False

	def canConstruct(self,argsList):
		pCity = argsList[0]
		eBuilding = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		return False

	def cannotConstruct(self,argsList):
		pCity = argsList[0]
		eBuilding = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		pPlayer = gc.getPlayer(pCity.getOwner())
		eBuildingClass = gc.getBuildingInfo(eBuilding).getBuildingClassType()
		
#		if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_MILITARY')) == gc.getInfoTypeForString('CIVIC_CRUSADERS'):
#			if eBuilding == gc.getInfoTypeForString('BUILDING_ELDER_COUNCIL'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_MARKET'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_OBELISK'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_MONEYCHANGER'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_THEATRE'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_AQUEDUCT'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_PUBLIC_BATHS'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_HERBALIST'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_CARNIVAL'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_COURTHOUSE'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_GAMBLING_HOUSE'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_GRANARY'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_SMOKEHOUSE'):
#				return True
#			if eBuilding == gc.getInfoTypeForString('BUILDING_BREWERY'):
#				return True

		return False

	def canCreate(self,argsList):
		pCity = argsList[0]
		eProject = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		return False

	def cannotCreate(self,argsList):
		pCity = argsList[0]
		eProject = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		pPlayer = gc.getPlayer(pCity.getOwner())

		if eProject == gc.getInfoTypeForString('PROJECT_WITCHHUNT'): 
			if pPlayer.getStateReligion() == -1:
				return True

		return False

	def canMaintain(self,argsList):
		pCity = argsList[0]
		eProcess = argsList[1]
		bContinue = argsList[2]
		return False

	def cannotMaintain(self,argsList):
		pCity = argsList[0]
		eProcess = argsList[1]
		bContinue = argsList[2]
		return False

	def AI_chooseTech(self,argsList):
		ePlayer = argsList[0]
		bFree = argsList[1]
		pPlayer = gc.getPlayer(ePlayer)
		eTeam = gc.getTeam(pPlayer.getTeam())
		iTech = -1

		iLeader = pPlayer.getLeaderType()
		iReligion = gc.getLeaderHeadInfo(iLeader).getFavoriteReligion()
		
		if iReligion == gc.getInfoTypeForString('RELIGION_CHAOS'):
			iTech = gc.getInfoTypeForString('TECH_CHAOSCORRUPTION')
			
		if iReligion == gc.getInfoTypeForString('RELIGION_SALVATION'):
			iTech = gc.getInfoTypeForString('TECH_WORDS_OF_SALVATION')

		if iReligion == gc.getInfoTypeForString('RELIGION_IMMORTALITY'):
			iTech = gc.getInfoTypeForString('TECH_CEREMONIAL_BURIAL')	

		if iReligion == gc.getInfoTypeForString('RELIGION_ELVEN'):
			iTech = gc.getInfoTypeForString('TECH_CONTEMPLATION')

		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_HUNG'):
			iTech = gc.getInfoTypeForString('TECH_HORSEBACK_RIDING')

#		if eTeam.isHasTech(gc.getInfoTypeForString('TECH_PHILOSOPHY')):
#			if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
#				bValid = true
#				for iTeam2 in range(gc.getMAX_PLAYERS()):
#					eTeam2 = gc.getTeam(iTeam2)
#					if eTeam2.isAlive():
#						if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_CORRUPTION_OF_SPIRIT')):
#							bValid = false
#				if bValid == true:
#					iTech = gc.getInfoTypeForString('TECH_CORRUPTION_OF_SPIRIT')

#		if eTeam.isHasTech(gc.getInfoTypeForString('TECH_PHILOSOPHY')):
#			if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
#				bValid = true
#				for iTeam2 in range(gc.getMAX_TEAMS()):
#					eTeam2 = gc.getTeam(iTeam2)
#					if eTeam2.isAlive():
#						if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_ORDERS_FROM_HEAVEN')):
#							bValid = false
#				if bValid == true:
#					iTech = gc.getInfoTypeForString('TECH_ORDERS_FROM_HEAVEN')

#		if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
#			bValid = true
#			for iTeam2 in range(gc.getMAX_TEAMS()):
#				eTeam2 = gc.getTeam(iTeam2)
#				if eTeam2.isAlive():
#					if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_INFERNAL_PACT')):
#						bValid = false
#			if bValid == true:
#				iTech = gc.getInfoTypeForString('TECH_INFERNAL_PACT')

		if iTech != -1:
			if eTeam.isHasTech(iTech) == False:
				return iTech

		return TechTypes.NO_TECH

	def AI_chooseProduction(self,argsList):
		pCity = argsList[0]
		#build those damn shrines		
		lShrines = ["BUILDINGCLASS_ANCESTORS_SHRINE", "BUILDINGCLASS_CHAOS_SHRINE", "BUILDINGCLASS_SALVATION_SHRINE", "BUILDINGCLASS_DESTRUCTION_SHRINE", "BUILDINGCLASS_SPIRITUALITY_SHRINE", "BUILDINGCLASS_OLDONES_SHRINE", "BUILDINGCLASS_IMMORTALITY_SHRINE" ]
		iShrineClass = [ CvUtil.findInfoTypeNum(gc.getBuildingClassInfo, gc.getNumBuildingClassInfos, item ) for item in lShrines]
		pPlayer = gc.getPlayer( pCity.getOwner( ) )
		#Inquisitors
		pCivInfo = gc.getCivilizationInfo(pPlayer.getCivilizationType())
		iInquisitorUnit = pCivInfo.getCivilizationUnits(gc.getInfoTypeForString('UNITCLASS_INQUISITOR'))

		if not gc.getMap( ).plot( pCity.getX( ), pCity.getY( ) ).getPlotCity( ).isHolyCity( ):
			if pCity.getProduction > 7:
				if self.getRandomNumber( 2 ) == 0:
					for iBuilding in range(gc.getNumBuildingInfos()):
						if gc.getBuildingInfo(iBuilding).getBuildingClassType() in iShrineClass:
							if pPlayer.canConstruct(iBuilding, False, False, False):
								gc.getMap( ).plot( pCity.getX( ), pCity.getY( ) ).getPlotCity( ).pushOrder( OrderTypes.ORDER_CONSTRUCT, iBuilding, -1, False, False, False, True )
								return True
		
		#build inquisitors
		if iInquisitorUnit != -1:
			if pCity.canTrain( iInquisitorUnit, 0, 0 ):
				if self.getRandomNumber( 2 ) == 0:
					gc.getMap( ).plot( pCity.getX( ), pCity.getY( ) ).getPlotCity( ).pushOrder( OrderTypes.ORDER_TRAIN, iInquisitorUnit, -1, False, False, False, True )
					return True
							
		return False

	def getRandomNumber(self, int):
		return CyGame().getSorenRandNum(int, "Warhammer_CvGameUtils")


	def AI_unitUpdate(self,argsList):
		pUnit = argsList[0]

		if pUnit.getUnitClassType() == gc.getInfoTypeForString('UNITCLASS_GIANT_SPIDER'):
			iX = pUnit.getX()
			iY = pUnit.getY()
			for iiX in range(iX-1, iX+2, 1):
				for iiY in range(iY-1, iY+2, 1):
					pPlot = CyMap().plot(iiX,iiY)
					for i in range(pPlot.getNumUnits()):
						if pPlot.getUnit(i).getOwner() != pUnit.getOwner():
							return 0
			return 1

		if pUnit.getOwner() == gc.getBARBARIAN_PLAYER():
			pPlot = pUnit.plot()
			if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_BARROW') or pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_RUINS') or pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_TROLLCAVE') or pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_BEAR_DEN'):
				if pPlot.getNumUnits() == 1:
					return 1

		if pUnit.getUnitClassType() == gc.getInfoTypeForString('UNITCLASS_NAGASH'):
			return 1

		if pUnit.getUnitClassType() == gc.getInfoTypeForString('UNITCLASS_INQUISITOR'):
			self.doInquisitorCore_AI( pUnit )
			return 1
					
		return False

	def doInquisitorCore_AI( self, pUnit ):
		iOwner = pUnit.getOwner( )
		iStateReligion = gc.getPlayer( iOwner ).getStateReligion( )
		lCities = PyPlayer( iOwner ).getCityList( )
		
		#Looks to see if the AI controls a Holy City that is not the State Religion
		for iCity in range( len( lCities ) ):
			for iReligion in range( 7 ):
				if iReligion != iStateReligion:
					pCity = gc.getPlayer( iOwner ).getCity( lCities[ iCity ].getID( ) )
					if pCity.isHolyCityByType( iReligion ):
						#Makes the unit move to the City and purge it
						if pUnit.generatePath( pCity.plot( ), 0, False, None ):
							self.doHolyCitySeekAndDestroy( pUnit, pCity )
							return
		
		for iCity in range( len( lCities ) ):
			for iReligion in range( 7 ):
				if iReligion != iStateReligion:
					pCity = gc.getPlayer( iOwner ).getCity( lCities[ iCity ].getID( ) )
					if pCity.isHasReligion( iReligion ):
						if pUnit.generatePath( pCity.plot( ), 0, False, None ):
							self.doHolyCitySeekAndDestroy( pUnit, pCity )
							return	

	def doHolyCitySeekAndDestroy( self, pUnit, pCity ):
		pPlayer = gc.getPlayer( pCity.getOwner( ) )

		if pUnit.getX( ) != pCity.getX( ) or pUnit.getY( ) != pCity.getY( ):
			pUnit.getGroup().pushMission(MissionTypes.MISSION_MOVE_TO, pCity.getX( ), pCity.getY( ), 0, False, True, MissionAITypes.NO_MISSIONAI, pUnit.plot(), pUnit)
		else:		
			#gets a list of all religions in the city except state religion
			lCityReligions = [ ]
			for iReligionLoop in range(gc.getNumReligionInfos( )):
				if pCity.isHasReligion( iReligionLoop ):
					if pPlayer.getStateReligion( ) != iReligionLoop:
						lCityReligions.append( iReligionLoop )
			
			# increases Anger for all AIs in City Religion List
			if len( lCityReligions ) > 0:
				lPlayers =PyGame().getCivPlayerList()
				for iAI_PlayersLoop in range( len(lPlayers) ):
					pSecondPlayer = lPlayers[iAI_PlayersLoop]
					for iAIAngerLoop in range( len( lCityReligions ) ):
						if pSecondPlayer.getStateReligion( ) == lCityReligions[iAIAngerLoop]:
							pSecondPlayer.AI_changeAttitude( pPlayer.getID( ), -1 )

			# Loop through all religions, remove them from the city
			for iReligionLoop in range(gc.getNumReligionInfos()):
				if iReligionLoop != pPlayer.getStateReligion( ):
					if pCity.isHolyCityByType( iReligionLoop ):
						gc.getGame( ).clearHolyCity( iReligionLoop )
				pCity.setHasReligion(iReligionLoop, 0, 0, 0)
			
			# Add player's state religion
			if ( gc.getPlayer( pUnit.getOwner( ) ).getStateReligion( ) != -1 ):
				iStateReligion = gc.getPlayer( pUnit.getOwner( ) ).getStateReligion( )
				pCity.setHasReligion( iStateReligion, 1, 0, 0 )
		
	def AI_doWar(self,argsList):
		eTeam = argsList[0]
		return False

	def AI_doDiplo(self,argsList):
		ePlayer = argsList[0]
		return False

	def calculateScore(self,argsList):
		ePlayer = argsList[0]
		bFinal = argsList[1]
		bVictory = argsList[2]
		
		iPopulationScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getPopScore(), gc.getGame().getInitPopulation(), gc.getGame().getMaxPopulation(), gc.getDefineINT("SCORE_POPULATION_FACTOR"), True, bFinal, bVictory)
		iLandScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getLandScore(), gc.getGame().getInitLand(), gc.getGame().getMaxLand(), gc.getDefineINT("SCORE_LAND_FACTOR"), True, bFinal, bVictory)
		iTechScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getTechScore(), gc.getGame().getInitTech(), gc.getGame().getMaxTech(), gc.getDefineINT("SCORE_TECH_FACTOR"), True, bFinal, bVictory)
		iWondersScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getWondersScore(), gc.getGame().getInitWonders(), gc.getGame().getMaxWonders(), gc.getDefineINT("SCORE_WONDER_FACTOR"), False, bFinal, bVictory)
		return int(iPopulationScore + iLandScore + iWondersScore + iTechScore)

	def doHolyCity(self):
		return True

	def doHolyCityTech(self,argsList):
		eTeam = argsList[0]
		ePlayer = argsList[1]
		eTech = argsList[2]
		bFirst = argsList[3]
		return True 

	def doGold(self,argsList):
		ePlayer = argsList[0]
		return False

	def doResearch(self,argsList):
		ePlayer = argsList[0]
		return False

	def doGoody(self,argsList):
		ePlayer = argsList[0]
		pPlot = argsList[1]
		pUnit = argsList[2]
		return False

	def doGrowth(self,argsList):
		pCity = argsList[0]
		return False

	def doProduction(self,argsList):
		pCity = argsList[0]
		return False

	def doCulture(self,argsList):
		pCity = argsList[0]
		return False

	def doPlotCulture(self,argsList):
		pCity = argsList[0]
		bUpdate = argsList[1]
		ePlayer = argsList[2]
		iCultureRate = argsList[3]
		return False

	def doReligion(self,argsList):
		pCity = argsList[0]
		return False

	def cannotSpreadReligion(self,argsList):
		iOwner, iUnitID, iReligion, iX, iY = argsList[0]
		return False

	def doGreatPeople(self,argsList):
		pCity = argsList[0]
		return False

	def doMeltdown(self,argsList):
		pCity = argsList[0]
		return False
	
	def doReviveActivePlayer(self,argsList):
		"allows you to perform an action after an AIAutoPlay"
		iPlayer = argsList[0]
		return False
	
	def doPillageGold(self, argsList):
		"controls the gold result of pillaging"
		pPlot = argsList[0]
		pUnit = argsList[1]
		
		iPillageGold = 0
		iPillageGold = CyGame().getSorenRandNum(gc.getImprovementInfo(pPlot.getImprovementType()).getPillageGold(), "Pillage Gold 1")
		iPillageGold += CyGame().getSorenRandNum(gc.getImprovementInfo(pPlot.getImprovementType()).getPillageGold(), "Pillage Gold 2")

		iPillageGold += (pUnit.getPillageChange() * iPillageGold) / 100
		
		return iPillageGold
	
	def doCityCaptureGold(self, argsList):
		"controls the gold result of capturing a city"
		
		pOldCity = argsList[0]
		
		iCaptureGold = 0
		
		iCaptureGold += gc.getDefineINT("BASE_CAPTURE_GOLD")
		iCaptureGold += (pOldCity.getPopulation() * gc.getDefineINT("CAPTURE_GOLD_PER_POPULATION"))
		iCaptureGold += CyGame().getSorenRandNum(gc.getDefineINT("CAPTURE_GOLD_RAND1"), "Capture Gold 1")
		iCaptureGold += CyGame().getSorenRandNum(gc.getDefineINT("CAPTURE_GOLD_RAND2"), "Capture Gold 2")

		if (gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS") > 0):
			iCaptureGold *= cyIntRange((CyGame().getGameTurn() - pOldCity.getGameTurnAcquired()), 0, gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS"))
			iCaptureGold /= gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS")
		
		return iCaptureGold
	
	def citiesDestroyFeatures(self,argsList):
		iX, iY= argsList
		return True
		
	def canFoundCitiesOnWater(self,argsList):
		iX, iY= argsList
		return False
		
	def doCombat(self,argsList):
		pSelectionGroup, pDestPlot = argsList
		return False

	def getConscriptUnitType(self, argsList):
		iPlayer = argsList[0]
		iConscriptUnitType = -1 #return this with the value of the UNIT TYPE you want to be conscripted, -1 uses default system
		
		return iConscriptUnitType

	def getCityFoundValue(self, argsList):
		iPlayer, iPlotX, iPlotY = argsList
		iFoundValue = -1 # Any value besides -1 will be used
		
		return iFoundValue
		
	def canPickPlot(self, argsList):
		pPlot = argsList[0]
		return true
		
	def getUnitCostMod(self, argsList):
		iPlayer, iUnit = argsList
		iCostMod = -1 # Any value > 0 will be used
		
		return iCostMod

	def getBuildingCostMod(self, argsList):
		iPlayer, iCityID, iBuilding = argsList
		pPlayer = gc.getPlayer(iPlayer)
		pCity = pPlayer.getCity(iCityID)

		iCostMod = -1 # Any value > 0 will be used

#		if iBuilding == gc.getInfoTypeForString('BUILDING_GATEWAY'): reuse for Gateways?
#			if pPlayer.isGamblingRing():
#				iCostMod = gc.getBuildingInfo(iBuilding).getCost() / 4

		
		
		return iCostMod
		
	def canUpgradeAnywhere(self, argsList):
		pUnit = argsList
		
		bCanUpgradeAnywhere = 0
		
		return bCanUpgradeAnywhere
		
	def getWidgetHelp(self, argsList):
		eWidgetType, iData1, iData2, bOption = argsList
		
		return u""
		
	def getUpgradePriceOverride(self, argsList):
		iPlayer, iUnitID, iUnitTypeUpgrade = argsList
		
		return -1	# Any value 0 or above will be used
	
	def getExperienceNeeded(self, argsList):
		# use this function to set how much experience a unit needs
		iLevel, iOwner = argsList
		
		iExperienceNeeded = 0

		# regular epic game experience		
		iExperienceNeeded = iLevel * iLevel + 1

		iModifier = gc.getPlayer(iOwner).getLevelExperienceModifier()
		if (0 != iModifier):
			iExperienceNeeded += (iExperienceNeeded * iModifier + 99) / 100   # ROUND UP
			
		return iExperienceNeeded
		
